/*Đường dẫn controller lode*/
var BASE_URL_AJAX_LODE = "http://localhost/yii/veso_v3/lode";
/*Đường dẫn controller messenger*/
var BASE_URL_MESSENGER = "http://localhost/yii/veso_v3/messenger";
function reloadCaptcha(imageName,path){
    var randomnumber=Math.floor(Math.random()*101001);
    var src = path+'/captcha.php?num=' + randomnumber;
    $('img[name='+imageName+']').attr('src',src);
}
function PopupCenter(pageURL, title,w,h) {
    var left = (screen.width/2)-(w/2);
    var top = (screen.height/2)-(h/2)-100;
    var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
function closePopup(){
    window.parent.close();
}
function changeForm(divId1,divId2){
    $("#"+divId1).show();  
    $("#"+divId2).hide() ;
}
function showForm(divID){
    if($("#"+divID).is(":hidden"))  $("#"+divID).show(); else  $("#"+divID).hide() ;
}
function closeForm(divID){
    $("#"+divID).hide();
}
function ShowFlash_swf(FlashIDName, FlashFileName, FlashWidth, FlashHeight, DNSSetting, WMODESetting, QSetting, FlashAlign){
    document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
    document.write('CODEBASE="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,0,0" ');
    document.write(' ID="'+FlashIDName+'" WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" ALIGN="'+FlashAlign+'">');
    document.write('<PARAM NAME="movie" VALUE="'+ FlashFileName +'">');
    document.write('<PARAM NAME="quality" VALUE="'+QSetting+'">');
    //document.write('<PARAM NAME="bgcolor" VALUE="'+FlashBGColor+'">');  BGCOLOR="'+FlashBGColor+'"
    document.write('<PARAM NAME="wmode" VALUE="'+WMODESetting+'">');
    document.write('<PARAM NAME="allowScriptAccess" VALUE="'+DNSSetting+'">');
    document.write('<EMBED SRC="'+ FlashFileName +'"  NAME="'+FlashIDName+'"');
    document.write(' WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" QUALITY="'+QSetting+'" ');
    document.write(' ALLOWSCRIPTACCESS="'+DNSSetting+'" ALIGN="'+FlashAlign+'" WMODE="'+WMODESetting+'" TYPE="application/x-shockwave-flash" ');
    document.write(' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" >');
    document.write('</EMBED>');
    document.write('</OBJECT>');
}
function processTime(d_hour,d_minute,d_second,divId){  
    var now = new Date();      
    var hour = now.getHours();
    var minute = now.getMinutes();     
    var second = now.getSeconds();
    var str = "";
    var sub_hour = d_hour - hour;
    var sub_minute = d_minute - minute;
    var sub_second = d_second - second;

    if(sub_minute == 60 ) sub_minute =0; 
    if(sub_minute > 60){ sub_minute = sub_minute-60;sub_hour = sub_hour +1;}  
    if(sub_minute <0){ sub_minute = 60 + sub_minute ;sub_hour = sub_hour - 1;}  

    if(sub_second == 60) sub_second = 0; 
    if(sub_second > 60){ sub_second = sub_second-60;sub_minute = sub_minute + 1;}  
    if(sub_second <0){ sub_second = 60 + sub_second ;sub_minute = sub_minute - 1;}
    if(sub_hour <0) {
        sub_hour =0;
        sub_minute = 0;
        sub_second = 0;
    }
    if(sub_hour <10 ) sub_hour = '0' + sub_hour;
    if(sub_minute < 10) sub_minute = '0' + sub_minute;
    if(sub_second < 10) sub_second = '0' + sub_second;  

    str = 'Time left   ' + sub_hour + ':' + sub_minute + ':' + sub_second;     

    $("#"+divId).html(str);
}
function loadKetquaMienbac(strUrl){
    var arr_loto = new Array();
    var dau0 = "";
    var dau1 = "";
    var dau2 = "";
    var dau3 = "";
    var dau4 = "";
    var dau5 = "";
    var dau6 = "";
    var dau7 = "";
    var dau8 = "";
    var dau9 = "";
    $.ajax({
        type: "GET",
        url: strUrl,
        data: "",
        success: function(msg){            
            if(msg !=0){
                var arr = eval('(' + msg + ')');
                if(arr["giai_bay_4"]) arr_loto[0]= arr["giai_bay_4"].substr(arr["giai_bay_4"].length-2,2); else arr_loto[0] = "";
                if(arr["giai_bay_3"]) arr_loto[1]= arr["giai_bay_3"].substr(arr["giai_bay_3"].length-2,2); else arr_loto[1] = ""; 
                if(arr["giai_bay_2"]) arr_loto[2]= arr["giai_bay_2"].substr(arr["giai_bay_2"].length-2,2); else arr_loto[2] = ""; 
                if(arr["giai_bay_1"]) arr_loto[3]= arr["giai_bay_1"].substr(arr["giai_bay_1"].length-2,2); else arr_loto[3] = ""; 

                if(arr["giai_sau_3"]) arr_loto[4]= arr["giai_sau_3"].substr(arr["giai_sau_3"].length-2,2); else arr_loto[4] = ""; 
                if(arr["giai_sau_2"]) arr_loto[5]= arr["giai_sau_2"].substr(arr["giai_sau_2"].length-2,2); else arr_loto[5] = ""; 
                if(arr["giai_sau_1"]) arr_loto[6]= arr["giai_sau_1"].substr(arr["giai_sau_1"].length-2,2); else arr_loto[6] = ""; 

                if(arr["giai_nam_6"]) arr_loto[7]= arr["giai_nam_6"].substr(arr["giai_nam_6"].length-2,2); else arr_loto[7] = ""; 
                if(arr["giai_nam_5"]) arr_loto[8]= arr["giai_nam_5"].substr(arr["giai_nam_5"].length-2,2); else arr_loto[8] = ""; 
                if(arr["giai_nam_4"]) arr_loto[9]= arr["giai_nam_4"].substr(arr["giai_nam_4"].length-2,2); else arr_loto[9] = ""; 
                if(arr["giai_nam_3"]) arr_loto[10]= arr["giai_nam_3"].substr(arr["giai_nam_3"].length-2,2); else arr_loto[10] = ""; 
                if(arr["giai_nam_2"]) arr_loto[11]= arr["giai_nam_2"].substr(arr["giai_nam_2"].length-2,2); else arr_loto[11] = ""; 
                if(arr["giai_nam_1"]) arr_loto[12]= arr["giai_nam_1"].substr(arr["giai_nam_1"].length-2,2); else arr_loto[12] = ""; 

                if(arr["giai_tu_4"]) arr_loto[13]= arr["giai_tu_4"].substr(arr["giai_tu_4"].length-2,2); else arr_loto[13] = ""; 
                if(arr["giai_tu_3"]) arr_loto[14]= arr["giai_tu_3"].substr(arr["giai_tu_3"].length-2,2); else arr_loto[14] = ""; 
                if(arr["giai_tu_2"]) arr_loto[15]= arr["giai_tu_2"].substr(arr["giai_tu_2"].length-2,2); else arr_loto[15] = ""; 
                if(arr["giai_tu_1"]) arr_loto[16]= arr["giai_tu_1"].substr(arr["giai_tu_1"].length-2,2); else arr_loto[16] = ""; 

                if(arr["giai_ba_6"]) arr_loto[17]= arr["giai_ba_6"].substr(arr["giai_ba_6"].length-2,2); else arr_loto[17] = ""; 
                if(arr["giai_ba_5"]) arr_loto[18]= arr["giai_ba_5"].substr(arr["giai_ba_5"].length-2,2); else arr_loto[18] = ""; 
                if(arr["giai_ba_4"]) arr_loto[19]= arr["giai_ba_4"].substr(arr["giai_ba_4"].length-2,2); else arr_loto[19] = ""; 
                if(arr["giai_ba_3"]) arr_loto[20]= arr["giai_ba_3"].substr(arr["giai_ba_3"].length-2,2); else arr_loto[20] = ""; 
                if(arr["giai_ba_2"]) arr_loto[21]= arr["giai_ba_2"].substr(arr["giai_ba_2"].length-2,2); else arr_loto[21] = ""; 
                if(arr["giai_ba_1"]) arr_loto[22]= arr["giai_ba_1"].substr(arr["giai_ba_1"].length-2,2); else arr_loto[22] = ""; 

                if(arr["giai_nhi_2"]) arr_loto[23]= arr["giai_nhi_2"].substr(arr["giai_nhi_2"].length-2,2); else arr_loto[23] = ""; 
                if(arr["giai_nhi_1"]) arr_loto[24]= arr["giai_nhi_1"].substr(arr["giai_nhi_1"].length-2,2); else arr_loto[24] = ""; 

                if(arr["giai_nhat"]) arr_loto[25]= arr["giai_nhat"].substr(arr["giai_nhat"].length-2,2); else arr_loto[25] = ""; 

                if(arr["giai_dacbiet"]) arr_loto[26]= arr["giai_dacbiet"].substr(arr["giai_dacbiet"].length-2,2); else arr_loto[26] = ""; 

                for(var i=0;i< arr_loto.length;i++){
                    if(arr_loto[i].substr(0,1)=='0'){
                        dau0 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='1'){
                        dau1 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='2'){
                        dau2 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='3'){
                        dau3 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='4'){
                        dau4 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='5'){
                        dau5 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='6'){
                        dau6 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='7'){
                        dau7 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='8'){
                        dau8 += arr_loto[i].substr(1,1) + ","; 
                    }
                    if(arr_loto[i].substr(0,1)=='9'){
                        dau9 += arr_loto[i].substr(1,1) + ","; 
                    } 
                }
                $("#dau0").html(dau0);
                $("#dau1").html(dau1);
                $("#dau2").html(dau2);
                $("#dau3").html(dau3);
                $("#dau4").html(dau4);
                $("#dau5").html(dau5);
                $("#dau6").html(dau6);
                $("#dau7").html(dau7);
                $("#dau8").html(dau8);
                $("#dau9").html(dau9);

                if(arr["giai_bay_4"]){ 
                    $("#giai_bay_4").removeClass("loading");                      
                    $("#giai_bay_4").html(arr["giai_bay_4"]);

                    $("#loto74").removeClass("loading");
                    $("#loto74").html(arr["giai_bay_4"].substr(arr["giai_bay_4"].length-2,2));
                }
                if(arr["giai_bay_3"]){ 
                    $("#giai_bay_3").removeClass("loading");
                    $("#giai_bay_3").html(arr["giai_bay_3"]);

                    $("#loto73").removeClass("loading");
                    $("#loto73").html(arr["giai_bay_3"].substr(arr["giai_bay_3"].length-2,2));
                }
                if(arr["giai_bay_2"]){ 
                    $("#giai_bay_2").removeClass("loading");
                    $("#giai_bay_2").html(arr["giai_bay_2"]);

                    $("#loto72").removeClass("loading");
                    $("#loto72").html(arr["giai_bay_2"].substr(arr["giai_bay_2"].length-2,2));
                }
                if(arr["giai_bay_1"]){ 
                    $("#giai_bay_1").removeClass("loading");
                    $("#giai_bay_1").html(arr["giai_bay_1"]);

                    $("#loto71").removeClass("loading");
                    $("#loto71").html(arr["giai_bay_1"].substr(arr["giai_bay_1"].length-2,2));
                }
                if(arr["giai_sau_1"]){
                    $("#giai_sau_1").removeClass("loading");
                    $("#giai_sau_1").html(arr["giai_sau_1"]);

                    $("#loto61").removeClass("loading");
                    $("#loto61").html(arr["giai_sau_1"].substr(arr["giai_sau_1"].length-2,2));
                }
                if(arr["giai_sau_2"]){
                    $("#giai_sau_2").removeClass("loading");
                    $("#giai_sau_2").html(arr["giai_sau_2"]);

                    $("#loto62").removeClass("loading");
                    $("#loto62").html(arr["giai_sau_2"].substr(arr["giai_sau_2"].length-2,2));
                }
                if(arr["giai_sau_3"]){
                    $("#giai_sau_3").removeClass("loading");
                    $("#giai_sau_3").html(arr["giai_sau_3"]);

                    $("#loto63").removeClass("loading");
                    $("#loto63").html(arr["giai_sau_3"].substr(arr["giai_sau_3"].length-2,2));
                }
                if(arr["giai_nam_1"]){
                    $("#giai_nam_1").removeClass("loading"); 
                    $("#giai_nam_1").html(arr["giai_nam_1"]);

                    $("#loto51").removeClass("loading");
                    $("#loto51").html(arr["giai_nam_1"].substr(arr["giai_nam_1"].length-2,2));
                }
                if(arr["giai_nam_2"]){
                    $("#giai_nam_2").removeClass("loading");
                    $("#giai_nam_2").html(arr["giai_nam_2"]);

                    $("#loto52").removeClass("loading");
                    $("#loto52").html(arr["giai_nam_2"].substr(arr["giai_nam_2"].length-2,2));
                }
                if(arr["giai_nam_3"]){
                    $("#giai_nam_3").removeClass("loading");
                    $("#giai_nam_3").html(arr["giai_nam_3"]);

                    $("#loto53").removeClass("loading");
                    $("#loto53").html(arr["giai_nam_3"].substr(arr["giai_nam_3"].length-2,2));
                }
                if(arr["giai_nam_4"]){
                    $("#giai_nam_4").removeClass("loading");
                    $("#giai_nam_4").html(arr["giai_nam_4"]);

                    $("#loto54").removeClass("loading");
                    $("#loto54").html(arr["giai_nam_4"].substr(arr["giai_nam_4"].length-2,2));
                }
                if(arr["giai_nam_5"]){
                    $("#giai_nam_5").removeClass("loading");
                    $("#giai_nam_5").html(arr["giai_nam_5"]);

                    $("#loto55").removeClass("loading");
                    $("#loto55").html(arr["giai_nam_5"].substr(arr["giai_nam_5"].length-2,2));
                }
                if(arr["giai_nam_6"]){
                    $("#giai_nam_6").removeClass("loading");
                    $("#giai_nam_6").html(arr["giai_nam_6"]);

                    $("#loto56").removeClass("loading");
                    $("#loto56").html(arr["giai_nam_6"].substr(arr["giai_nam_6"].length-2,2));
                }
                if(arr["giai_tu_1"]){
                    $("#giai_tu_1").removeClass("loading");
                    $("#giai_tu_1").html(arr["giai_tu_1"]);

                    $("#loto41").removeClass("loading");
                    $("#loto41").html(arr["giai_tu_1"].substr(arr["giai_tu_1"].length-2,2));
                }
                if(arr["giai_tu_2"]){
                    $("#giai_tu_2").removeClass("loading");
                    $("#giai_tu_2").html(arr["giai_tu_2"]);

                    $("#loto42").removeClass("loading");
                    $("#loto42").html(arr["giai_tu_2"].substr(arr["giai_tu_2"].length-2,2));
                }
                if(arr["giai_tu_3"]){
                    $("#giai_tu_3").removeClass("loading");
                    $("#giai_tu_3").html(arr["giai_tu_3"]);

                    $("#loto43").removeClass("loading");
                    $("#loto43").html(arr["giai_tu_3"].substr(arr["giai_tu_3"].length-2,2));
                }
                if(arr["giai_tu_4"]){
                    $("#giai_tu_4").removeClass("loading");
                    $("#giai_tu_4").html(arr["giai_tu_4"]);

                    $("#loto44").removeClass("loading");
                    $("#loto44").html(arr["giai_tu_4"].substr(arr["giai_tu_4"].length-2,2));
                }                  
                if(arr["giai_ba_1"]){
                    $("#giai_ba_1").removeClass("loading");
                    $("#giai_ba_1").html(arr["giai_ba_1"]);

                    $("#loto31").removeClass("loading");
                    $("#loto31").html(arr["giai_ba_1"].substr(arr["giai_ba_1"].length-2,2));
                }
                if(arr["giai_ba_2"]){
                    $("#giai_ba_2").removeClass("loading");
                    $("#giai_ba_2").html(arr["giai_ba_2"]);

                    $("#loto32").removeClass("loading");
                    $("#loto32").html(arr["giai_ba_2"].substr(arr["giai_ba_2"].length-2,2));
                }
                if(arr["giai_ba_3"]){
                    $("#giai_ba_3").removeClass("loading");
                    $("#giai_ba_3").html(arr["giai_ba_3"]);

                    $("#loto33").removeClass("loading");
                    $("#loto33").html(arr["giai_ba_3"].substr(arr["giai_ba_3"].length-2,2));
                }
                if(arr["giai_ba_4"]){
                    $("#giai_ba_4").removeClass("loading");
                    $("#giai_ba_4").html(arr["giai_ba_4"]);

                    $("#loto34").removeClass("loading");
                    $("#loto34").html(arr["giai_ba_4"].substr(arr["giai_ba_4"].length-2,2));
                }
                if(arr["giai_ba_5"]){
                    $("#giai_ba_5").removeClass("loading");
                    $("#giai_ba_5").html(arr["giai_ba_5"]);

                    $("#loto35").removeClass("loading");
                    $("#loto35").html(arr["giai_ba_5"].substr(arr["giai_ba_5"].length-2,2));
                }
                if(arr["giai_ba_6"]){
                    $("#giai_ba_6").removeClass("loading");
                    $("#giai_ba_6").html(arr["giai_ba_6"]);

                    $("#loto36").removeClass("loading");
                    $("#loto36").html(arr["giai_ba_6"].substr(arr["giai_ba_6"].length-2,2));
                }
                if(arr["giai_nhi_1"]){
                    $("#giai_nhi_1").removeClass("loading");
                    $("#giai_nhi_1").html(arr["giai_nhi_1"]);

                    $("#loto21").removeClass("loading");
                    $("#loto21").html(arr["giai_nhi_1"].substr(arr["giai_nhi_1"].length-2,2));
                }
                if(arr["giai_nhi_2"]){
                    $("#giai_nhi_2").removeClass("loading");
                    $("#giai_nhi_2").html(arr["giai_nhi_2"]);

                    $("#loto22").removeClass("loading");
                    $("#loto22").html(arr["giai_nhi_2"].substr(arr["giai_nhi_2"].length-2,2));
                }
                if(arr["giai_nhat"]){
                    $("#giai_nhat").removeClass("loading");
                    $("#giai_nhat").html(arr["giai_nhat"]);

                    $("#loto1").removeClass("loading");
                    $("#loto1").html(arr["giai_nhat"].substr(arr["giai_nhat"].length-2,2));
                }
                if(arr["giai_dacbiet"]){
                    $("#giai_dacbiet").removeClass("loading");
                    $("#giai_dacbiet").html(arr["giai_dacbiet"]);

                    $("#lotodb").removeClass("loading");
                    $("#lotodb").html(arr["giai_dacbiet"].substr(arr["giai_dacbiet"].length-2,2));
                } 

            }
        }

    });
}
function loadKetquaMiennam(strUrl,str_province){
    $.ajax({
        type: "GET",
        url: strUrl,
        data: "str_province="+str_province,
        success: function(msg){


            var arr = eval('(' + msg + ')');     
            if(msg !=0){          
                for(var i=0;i<arr.length;i++){                  
                    if(arr[i]["giai_tam"]){
                        $("#giai_tam"+i).removeClass("loading");
                        $("#giai_tam"+i).html(arr[i]["giai_tam"]);
                    }
                    if(arr[i]["giai_bay"]){ 
                        $("#giai_bay"+i).removeClass("loading");
                        $("#giai_bay"+i).html(arr[i]["giai_bay"]);
                    }
                    if(arr[i]["giai_sau_1"]){
                        $("#giai_sau_1"+i).removeClass("loading");
                        $("#giai_sau_1"+i).html(arr[i]["giai_sau_1"]);
                    }
                    if(arr[i]["giai_sau_2"]){
                        $("#giai_sau_2"+i).removeClass("loading");
                        $("#giai_sau_2"+i).html(arr[i]["giai_sau_2"]);
                    }
                    if(arr[i]["giai_sau_3"]){
                        $("#giai_sau_3"+i).removeClass("loading");
                        $("#giai_sau_3"+i).html(arr[i]["giai_sau_3"]);
                    }
                    if(arr[i]["giai_nam"]){
                        $("#giai_nam"+i).removeClass("loading");
                        $("#giai_nam"+i).html(arr[i]["giai_nam"]);
                    }
                    if(arr[i]["giai_tu_1"]){
                        $("#giai_tu_1"+i).removeClass("loading");
                        $("#giai_tu_1"+i).html(arr[i]["giai_tu_1"]);
                    }
                    if(arr[i]["giai_tu_2"]){
                        $("#giai_tu_2"+i).removeClass("loading");
                        $("#giai_tu_2"+i).html(arr[i]["giai_tu_2"]);
                    }
                    if(arr[i]["giai_tu_3"]){
                        $("#giai_tu_3"+i).removeClass("loading");
                        $("#giai_tu_3"+i).html(arr[i]["giai_tu_3"]);
                    }
                    if(arr[i]["giai_tu_4"]){
                        $("#giai_tu_4"+i).removeClass("loading");
                        $("#giai_tu_4"+i).html(arr[i]["giai_tu_4"]);
                    }
                    if(arr[i]["giai_tu_5"]){
                        $("#giai_tu_5"+i).removeClass("loading");
                        $("#giai_tu_5"+i).html(arr[i]["giai_tu_5"]);
                    }
                    if(arr[i]["giai_tu_6"]){
                        $("#giai_tu_6"+i).removeClass("loading");
                        $("#giai_tu_6"+i).html(arr[i]["giai_tu_6"]);
                    }
                    if(arr[i]["giai_tu_7"]){
                        $("#giai_tu_7"+i).removeClass("loading");
                        $("#giai_tu_7"+i).html(arr[i]["giai_tu_7"]);
                    }
                    if(arr[i]["giai_ba_1"]){
                        $("#giai_ba_1"+i).removeClass("loading");
                        $("#giai_ba_1"+i).html(arr[i]["giai_ba_1"]);
                    }
                    if(arr[i]["giai_ba_2"]){
                        $("#giai_ba_2"+i).removeClass("loading");
                        $("#giai_ba_2"+i).html(arr[i]["giai_ba_2"]);
                    }
                    if(arr[i]["giai_nhi"]){
                        $("#giai_nhi"+i).removeClass("loading");
                        $("#giai_nhi"+i).html(arr[i]["giai_nhi"]);
                    }
                    if(arr[i]["giai_nhat"]){
                        $("#giai_nhat"+i).removeClass("loading");
                        $("#giai_nhat"+i).html(arr[i]["giai_nhat"]);
                    }
                    if(arr[i]["giai_dacbiet"]){
                        $("#giai_dacbiet"+i).removeClass("loading");
                        $("#giai_dacbiet"+i).html(arr[i]["giai_dacbiet"]);
                    } 
                }                

            }
        }

    });
}
function loadKetquaMientrung(strUrl,str_province){
    $.ajax({
        type: "GET",
        url: strUrl,
        data: "str_province="+str_province,
        success: function(msg){

            var arr = eval('(' + msg + ')');   
            if(msg !=0){           
                for(var i=0;i<arr.length;i++){                  
                    if(arr[i]["giai_tam"]){
                        $("#giai_tam"+i).removeClass("loading");
                        $("#giai_tam"+i).html(arr[i]["giai_tam"]);
                    }
                    if(arr[i]["giai_bay"]){ 
                        $("#giai_bay"+i).removeClass("loading");
                        $("#giai_bay"+i).html(arr[i]["giai_bay"]);
                    }
                    if(arr[i]["giai_sau_1"]){
                        $("#giai_sau_1"+i).removeClass("loading");
                        $("#giai_sau_1"+i).html(arr[i]["giai_sau_1"]);
                    }
                    if(arr[i]["giai_sau_2"]){
                        $("#giai_sau_2"+i).removeClass("loading");
                        $("#giai_sau_2"+i).html(arr[i]["giai_sau_2"]);
                    }
                    if(arr[i]["giai_sau_3"]){
                        $("#giai_sau_3"+i).removeClass("loading");
                        $("#giai_sau_3"+i).html(arr[i]["giai_sau_3"]);
                    }
                    if(arr[i]["giai_nam"]){
                        $("#giai_nam"+i).removeClass("loading");
                        $("#giai_nam"+i).html(arr[i]["giai_nam"]);
                    }
                    if(arr[i]["giai_tu_1"]){
                        $("#giai_tu_1"+i).removeClass("loading");
                        $("#giai_tu_1"+i).html(arr[i]["giai_tu_1"]);
                    }
                    if(arr[i]["giai_tu_2"]){
                        $("#giai_tu_2"+i).removeClass("loading");
                        $("#giai_tu_2"+i).html(arr[i]["giai_tu_2"]);
                    }
                    if(arr[i]["giai_tu_3"]){
                        $("#giai_tu_3"+i).removeClass("loading");
                        $("#giai_tu_3"+i).html(arr[i]["giai_tu_3"]);
                    }
                    if(arr[i]["giai_tu_4"]){
                        $("#giai_tu_4"+i).removeClass("loading");
                        $("#giai_tu_4"+i).html(arr[i]["giai_tu_4"]);
                    }
                    if(arr[i]["giai_tu_5"]){
                        $("#giai_tu_5"+i).removeClass("loading");
                        $("#giai_tu_5"+i).html(arr[i]["giai_tu_5"]);
                    }
                    if(arr[i]["giai_tu_6"]){
                        $("#giai_tu_6"+i).removeClass("loading");
                        $("#giai_tu_6"+i).html(arr[i]["giai_tu_6"]);
                    }
                    if(arr[i]["giai_tu_7"]){
                        $("#giai_tu_7"+i).removeClass("loading");
                        $("#giai_tu_7"+i).html(arr[i]["giai_tu_7"]);
                    }
                    if(arr[i]["giai_ba_1"]){
                        $("#giai_ba_1"+i).removeClass("loading");
                        $("#giai_ba_1"+i).html(arr[i]["giai_ba_1"]);
                    }
                    if(arr[i]["giai_ba_2"]){
                        $("#giai_ba_2"+i).removeClass("loading");
                        $("#giai_ba_2"+i).html(arr[i]["giai_ba_2"]);
                    }
                    if(arr[i]["giai_nhi"]){
                        $("#giai_nhi"+i).removeClass("loading");
                        $("#giai_nhi"+i).html(arr[i]["giai_nhi"]);
                    }
                    if(arr[i]["giai_nhat"]){
                        $("#giai_nhat"+i).removeClass("loading");
                        $("#giai_nhat"+i).html(arr[i]["giai_nhat"]);
                    }
                    if(arr[i]["giai_dacbiet"]){
                        $("#giai_dacbiet"+i).removeClass("loading");
                        $("#giai_dacbiet"+i).html(arr[i]["giai_dacbiet"]);
                    } 
                }                

            }
        }

    });
}
function loadingAjax(){     
    $('body').append('<div id="fade1"></div>'); 
    $('#fade1').css({'filter' : 'alpha(opacity=0.6)'}).fadeIn();
    return false;        
}

function closeLoadingAjax()
{
    $('#fade1').fadeOut(function() {
        $('#fade1').remove();  
    });    
}

